package com.shey.adapter;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;

import com.shey.qiuckpictest.R;
import com.shey.imageloader.MyImageLoader;
import com.shey.widget.WidthSquareImageView;

import java.util.List;

/**
 * Created by SheyChen on 2015/12/3 14:18.
 * Email 1768037936@qq.com
 */
public class ChildPhotoAdapter extends SimpleBaseAdapter<String> {

    public ChildPhotoAdapter(Context context, List<String> data) {
        super(context, data);
    }

    @Override
    public int getItemResource() {
        return R.layout.item_childphoto;
    }

    @Override
    public View getItemView(int position, View convertView, ViewHolder holder) {
        WidthSquareImageView photoView;

        photoView = holder.getView(R.id.item_childphoto_imageview);

        String photoPath = (String) getItem(position);
        if (!TextUtils.isEmpty(photoPath)) {
            MyImageLoader.getInstance().displayImage(photoView, photoPath);
        }

        return convertView;
    }
}
